/* GUI CONVERTED from reoptr2a.p (converter v1.75) Sat Aug 12 23:07:40 2000 */
/* reoptr2a.p - sub program for repetitive transaction                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                     */
/* All rights reserved worldwide.  This is an unpublished work.            */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                      */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                    */
/* REVISION: 6.0       LAST MODIFIED:  10/18/90           BY: SMM *D108*   */
/* REVISION: 6.0       LAST MODIFIED:  11/20/90           BY: emb *D223*   */
/* REVISION: 6.0       LAST MODIFIED:  03/22/91           BY: emb *D448*   */
/* REVISION: 7.0       LAST MODIFIED:  03/09/92           BY: smm *F230*   */
/* REVISION: 7.0       LAST MODIFIED:  03/30/92           BY: emb *F331*   */
/* REVISION: 7.0       LAST MODIFIED:  10/13/92           BY: emb *G184*   */
/* REVISION: 7.3       LAST MODIFIED:  03/01/93           BY: emb *G760*   */
/* REVISION: 7.4       LAST MODIFIED:  07/22/93           BY: pcd *H039*   */
/* REVISION: 7.5       LAST MODIFIED:  10/24/94           BY: mwd *J034*   */
/* REVISION: 8.5       LAST MODIFIED:  05/01/96           BY: jym *G1MN*   */

/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan      */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb               */
         {mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE reoptr2a_p_1 "Control Total"
/* MaxLen: Comment: */

&SCOPED-DEFINE reoptr2a_p_2 "Input Total"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

         define shared frame a.
         define shared variable old_emp like op_emp.
         define  shared variable input_total as decimal format "->>9.9<<"
            label {&reoptr2a_p_2}.
         define shared variable control_total like input_total
            label {&reoptr2a_p_1}.
         define shared variable shift like op_shift.
         define shared variable earn like op_earn.
         define shared variable site like rps_site no-undo.
         define shared variable last_date like op_date.
         define shared variable emp_recno as recid.
         define shared variable continue as logical.
/*F230*/ define shared variable prline like rps_line no-undo.

/*G1MN* /*H039*/ {gpglefdf.i} */
/*G1MN*/ {gpglefv.i}

/*G760*/ {reopf10a.i}

         do with frame a:
            ststatus = stline[1].
            status input ststatus.

            prompt-for op_emp with frame a editing:

               /* FIND NEXT/PREVIOUS RECORD */
               {mfnp.i emp_mstr op_emp emp_addr op_emp emp_addr emp_addr}

               if recno <> ? then do:
                  display emp_addr @ op_emp
                  emp_fname + " " + emp_lname @ ad_name.
               end.
            end.

            find emp_mstr where emp_addr = input op_emp no-lock no-error.
            if not available emp_mstr then do:
               {mfmsg.i 520 3} /* "Employee number does not exist.". */
               undo, retry.
            end.

            if lookup(emp_status,"AC,PT") = 0 then do:
               {mfmsg.i 4027 3} /* "Employee not on active status" */
               undo,retry.
            end.

            emp_recno = recid(emp_mstr).

            display emp_addr @ op_emp emp_fname + " " + emp_lname @ ad_name.

            if old_emp <> ? and old_emp <> input op_emp then do:
               control_total = 0.
               input_total = 0.
            end.

            display last_date shift site control_total input_total.

            set1: do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.

               set
                  last_date
                  shift
                  site
                  control_total
               editing:

                  if frame-field = "site" then do:
                     /* FIND/NEXT PREVIOUS */
                     {mfnp.i si_mstr site si_site site si_site si_site}
                     if recno <> ? then do:
                        display si_site @ site.
                     end.
                  end. /* do */
                  else do:
                     readkey.
                     apply lastkey.
                  end.
               end. /* editing */

/*G184*/       /* Check effective date*/
/*G184*//*H039*{mfglef.i last_date} */
/*G1MN* /*H039*/       {gpglef.i ""WO"" glentity last_date} */

               find si_mstr no-lock where si_site = site no-error.
               if not available si_mstr then do:
                  {mfmsg.i 708 3} /* site does not exist */
                  next-prompt site.
                  undo, retry.
               end.
               global_site = site.

/*J034*/       {gprun.i ""gpsiver.p""
                  "(input site, input recid(si_mstr), output return_int)"}
/*GUI*/ if global-beam-me-up then undo, leave.

/*J034*/       if return_int = 0 then do:
/*J034*/          {mfmsg.i 725 3} /* USER DOES NOT HAVE  */
                                     /* ACCESS TO THIS SITE */
/*J034*/          next-prompt site.
/*J034*/          undo, retry.
/*J034*/       end.
/*G1MN*/       /* Check effective date*/
/*G1MN*/           {gpglef1.i
                     &module = ""WO""
                     &entity = si_entity
                     &date = last_date
                     &prompt = "last_date"
                     &frame = "a"
                     &loop = "set1"
                     }

            end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* set1 */
            continue = yes.
            old_emp = input op_emp.
         end.
